Skip to content

feat: add Linux Clang+libc++ build configuration#1633

Closed
hk2166 wants to merge 5 commits into
hiero-ledger:mainfrom
hk2166:feat/linux-clang-libcxx-build
Closed

feat: add Linux Clang+libc++ build configuration#1633
hk2166 wants to merge 5 commits into
hiero-ledger:mainfrom
hk2166:feat/linux-clang-libcxx-build

Conversation

@hk2166

@hk2166 hk2166 commented May 10, 2026

Copy link
Copy Markdown
Contributor

Description:

Add Linux Clang+libc++ build configuration to test stdlib portability on self-hosted Linux runners, providing a faster and cheaper alternative to macOS builds for catching libc++-specific issues.

  • Add custom vcpkg triplet x64-linux-clang-libcxx in vcpkg-triplets/
  • Add CMake configure presets linux-x64-clang-libcxx-debug and linux-x64-clang-libcxx-release
  • Add CMake build presets for both debug and release configurations
  • Add build-linux-clang-libcxx job to zxc-build-library.yaml workflow
  • Add run-clang-libcxx-build input flag to workflow (defaults to false)
  • Enable libc++ build in nightly workflow via on-schedule-builds.yaml
  • Document libc++ build requirements and usage in README.md

Related issue(s):

Fixes #1620

Technical Implementation

Custom vcpkg Triplet (vcpkg-triplets/x64-linux-clang-libcxx.cmake):

  • Configures vcpkg to build all C++ dependencies with Clang and libc++
  • Sets compiler flags: -stdlib=libc++
  • Sets linker flags: -stdlib=libc++ -lc++abi
  • Ensures ABI compatibility across gRPC, Protobuf, abseil, log4cxx, and all other C++ dependencies

CMake Presets:

  • Inherit from vcpkg-base for consistency
  • Override compiler to Clang
  • Add libc++ flags to compilation and linking
  • Point to custom triplet via VCPKG_OVERLAY_TRIPLETS

CI Integration:

  • New job runs only when run-clang-libcxx-build: true is set
  • Enabled in nightly workflow, disabled for PR builds
  • Installs libc++-dev and libc++abi-dev packages
  • Builds and runs unit tests for both Debug and Release configurations

@hk2166
hk2166 requested review from a team as code owners May 10, 2026 17:34
@hk2166
hk2166 requested review from gsstoykov and leninmehedy May 10, 2026 17:34
@codacy-production

codacy-production Bot commented May 10, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@hk2166
hk2166 force-pushed the feat/linux-clang-libcxx-build branch from ce4ed2a to 38db10d Compare May 10, 2026 17:38
@github-actions

Copy link
Copy Markdown

Hey @hk2166 👋 thanks for the PR!
I'm your friendly PR Helper Bot 🤖 and I'll be riding shotgun on this one, keeping track of your PR's status to help you get it approved and merged.

This comment updates automatically as you push changes -- think of it as your PR's live scoreboard!
Here's the latest:


PR Checks

DCO Sign-off -- All commits have valid sign-offs. Nice work!


GPG Signature -- All commits have verified GPG signatures. Locked and loaded!


Merge Conflicts -- No merge conflicts detected. Smooth sailing!


Issue Link -- Linked to #1620 (assigned to you).


🎉 All checks passed! Your PR is ready for review. Great job!

@github-actions github-actions Bot added the status: needs review The pull request is ready for maintainer review label May 10, 2026
@hk2166

hk2166 commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

 Hi @gsstoykov @leninmehedy could you please review my PR when you get a chance?

I’d also appreciate any feedback or suggestions for improvement. If there’s anything that should be changed or refined, I’m happy to work on it.

@rwalworth rwalworth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this one up @hk2166! Solid skeleton - the custom triplet, presets, and nightly wiring all match the shape we discussed in #1620. A few things need to be fixed before this can merge - detailed comments below. Let me know if anything's unclear and I'll take another pass once these are addressed.

Comment thread CMakePresets.json
"description": "Configured via the vcpkg toolchain",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/package",
"generator": "Ninja Multi-Config",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): This change removes "generator": "Ninja Multi-Config" from the vcpkg-base preset. Since every existing Linux and macOS preset inherits from vcpkg-base, this drops them down to CMake's default generator on each platform (usually Unix Makefiles on Linux/macOS), which is a behavior change for the whole project - not just the new libc++ presets.

Beyond the runtime change, gtest_discover_tests is wired up with WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE} (see src/sdk/tests/unit/CMakeLists.txt:169 and the integration equivalent). That ${CMAKE_BUILD_TYPE} subdirectory is something multi-config generators produce; single-config generators don't, so removing this will likely break test discovery on the existing presets too.

Please restore the "generator": "Ninja Multi-Config" line in vcpkg-base. If you want the new libc++ presets to use a different generator, set it explicitly on those two presets only.

The display-name / cacheVariables shorthand cleanups in this file are fine - just the generator removal needs to be reverted.

Comment thread README.md Outdated
Comment on lines +152 to +154
For more detailed information about the libc++ build configuration, see [CLAUDE.md](CLAUDE.md).

For more detailed information about the libc++ build configuration, see [CLAUDE.md](CLAUDE.md).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): As we agreed on #1620, CLAUDE.md isn't a file we want in this repo - the mention in the issue's implementation steps was a copy-paste artifact from my template. README is the right home for all of this. Please remove both of these lines:

For more detailed information about the libc++ build configuration, see [CLAUDE.md](CLAUDE.md).

For more detailed information about the libc++ build configuration, see [CLAUDE.md](CLAUDE.md).

(Also note they're duplicated - the same line appears twice in a row.)

Could you also update the PR description? It still says "Create CLAUDE.md with comprehensive developer documentation," which isn't accurate anymore.

Comment on lines +398 to +410
- name: Run Unit Tests (Debug)
run: ctest -j 6 -C Debug --test-dir build/linux-x64-clang-libcxx-debug --output-on-failure
continue-on-error: false

- name: Configure CMake (Release)
run: cmake --preset linux-x64-clang-libcxx-release -DBUILD_TESTS=ON

- name: Build (Release)
run: cmake --build --preset linux-x64-clang-libcxx-release -j 6

- name: Run Unit Tests (Release)
run: ctest -j 6 -C Release --test-dir build/linux-x64-clang-libcxx-release --output-on-failure
continue-on-error: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): The step is named "Run Unit Tests" but the ctest invocation here runs every test discovered for the preset - both unit and integration tests. Integration tests require a live Hiero network (see config/local_node.json and the Prepare Hiero Solo step in the existing build job above at zxc-build-library.yaml:211). Since this new job doesn't stand up Solo, the integration tests will fail on every nightly run as soon as the cache warms up.

The repo's README.md already shows the right pattern for unit-only runs:

ctest -j 6 -C <CONFIG> --test-dir build/<PRESET> -R "TestVectors|UnitTests" --output-on-failure

You have two reasonable options:

  1. (Recommended for now) Restrict the new job to unit tests by adding -R "TestVectors|UnitTests" to both ctest invocations. This matches the spirit of [Intermediate]: Add linux-x64-clang-libcxx preset and run it as a nightly build #1620 - the goal is libc++ stdlib portability for the SDK, and unit tests exercise that surface area without needing a network.
  2. Wire in a Prepare Hiero Solo step before the test runs (matching the existing Linux job at lines 197-205) and use -E NodeUpdateTransactionIntegrationTests like the existing job does. This is a heavier nightly run but gives full coverage.

If you go with option 1, also rename the steps from "Run Unit Tests" to something accurate (the name is already correct in that case 🙂 - just keep it consistent).

.setNodeAccountIds({ AccountId(3) })
.setTransactionId(getTestTransactionIdMock())
.setKey(privateKey->getPublicKey())
.setKeyWithoutAlias(privateKey->getPublicKey())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (blocking): What's the reason for this setKey --> setKeyWithoutAlias change? It looks unrelated to the build-configuration scope of this PR.

I checked, and:

  • AccountCreateTransaction::setKey() is [[deprecated]], but the project doesn't enable -Werror=deprecated-declarations, so the deprecation alone shouldn't break the new libc++ build.
  • There are still ~40 other .setKey(...) call sites across the unit and integration test suites (e.g. AccountCreateTransactionUnitTests.cc:131, AccountUpdateTransactionUnitTests.cc:154, etc.). If this fix were genuinely needed for the libc++ build, you'd expect all of them to need it.

If something about the libc++ toolchain is actually erroring on this specific line, please share the error so I can understand the underlying issue (it would likely point at a real problem we'd want to fix more broadly). Otherwise, please revert this line - we can do a deprecated-setKey sweep as its own follow-up PR.

required: false
default: true
default: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Several of the new/changed lines in this file have trailing whitespace (e.g. default: true on this line, default: false on line 53, and a few of the blank "spacer" lines around the new run-clang-libcxx-build input). Also, there's a blank line just under on: near the top of the file that wasn't there before. None of this affects function - just an editor / pre-commit cleanup pass before next push.

run-windows-builds: true
run-macos-builds: true
run-clang-libcxx-build: true
upload-artifacts: false No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: This file lost its trailing newline (upload-artifacts: false is now the last byte). Easy fix - add the newline back.

@hk2166 hk2166 May 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed review. I’ve addressed the requested changes:

  • Restored Ninja Multi-Config on the shared vcpkg-base preset.
  • Removed the remaining CLAUDE.md references from the README and updated the PR description.
  • Restricted the new libc++ CI job to unit/test-vector tests with -R "TestVectors|UnitTests".
  • Reverted the unrelated setKeyWithoutAlias test change back to setKey.
  • Cleaned up trailing whitespace and restored the newline in on-schedule-builds.yaml.

@github-actions github-actions Bot added status: needs revision The pull request requires changes from the author before it can be reviewed or merged status: needs review The pull request is ready for maintainer review and removed status: needs review The pull request is ready for maintainer review status: needs revision The pull request requires changes from the author before it can be reviewed or merged labels May 12, 2026
Signed-off-by: hk2166 <9610hemant@gmail.com>
@hk2166
hk2166 force-pushed the feat/linux-clang-libcxx-build branch from 57af833 to 5bfa227 Compare May 12, 2026 04:51
@hk2166
hk2166 requested a review from rwalworth May 12, 2026 05:23
@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@hk2166 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 29 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 134dfb77-4852-40e0-adba-9c1e91002f14

📥 Commits

Reviewing files that changed from the base of the PR and between a898153 and 7867b3a.

📒 Files selected for processing (5)
  • .github/workflows/on-schedule-builds.yaml
  • .github/workflows/zxc-build-library.yaml
  • CMakePresets.json
  • README.md
  • vcpkg-triplets/x64-linux-clang-libcxx.cmake
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@hk2166

hk2166 commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

Hi @rwalworth , thanks again for the detailed review — I’ve addressed the requested changes and pushed the updates.

Whenever you get a chance, could you please take another pass on the PR?

Also curious to hear your thoughts on the overall Clang + libc++ setup approach (custom triplet + presets + nightly-only validation) and whether the structure looks reasonable to you going forward.

@hk2166 hk2166 closed this Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs review The pull request is ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Intermediate]: Add linux-x64-clang-libcxx preset and run it as a nightly build

2 participants